package com.gl.ruanzhu.controller;

import com.gl.basis.common.pojo.Page;
import com.gl.ruanzhu.indto.*;
import com.gl.ruanzhu.outDto.*;
import com.gl.ruanzhu.service.IScienceServicesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/scienceServices")
@Api(value = "", tags = {"科技服务"})
@Slf4j
public class ScienceServicesController {

    @Autowired
    private IScienceServicesService scienceServicesService;

    @ApiOperation(value = "设计发布列表接口")
    @PostMapping("/designRelease")
    @ResponseBody
    public Page<TaskOutDto> showDesignRelease(@RequestBody Page<TaskInDto> page){
        return scienceServicesService.getAll(page);
    }

    @ApiOperation(value = "查询需求子任务接口")
    @PostMapping("/showDesignSon")
    @ResponseBody
    public Page<TaskOutDto> showDesignSon(@RequestBody Page<TaskOutDto> page){
        Page<TaskOutDto> newPage= new Page<TaskOutDto>();
        newPage.setResult(scienceServicesService.showDesignSon(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "获取详情接口")
    @PostMapping("/getDetails")
    @ResponseBody
    public Page<TaskOutDto> getDetails(@RequestBody Page<TaskInDto> page){
        Page<TaskOutDto> newPage= new Page<TaskOutDto>();
        newPage.setResult(scienceServicesService.getDetails(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "申请列表接口")
    @PostMapping("/getSuppliers")
    @ResponseBody
    public Page<TaskSupplierOutDTO> getSuppliers(@RequestBody Page<TaskSupplierInDTO> page){
        Page<TaskSupplierOutDTO> newPage= new Page<TaskSupplierOutDTO>();
        newPage.setResult(scienceServicesService.getSuppliers(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "查询合同管理接口")
    @PostMapping("/getContract")
    @ResponseBody
    public Page<ContractOutDTO> getContract(@RequestBody Page<ContractInDTO> page){
        Page<ContractOutDTO> newPage= new Page<ContractOutDTO>();
        newPage.setResult(scienceServicesService.getContract(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "查询待响应接口")
    @PostMapping("/getUnResponded")
    @ResponseBody
    public Page<TaskOutDto> getUnResponded(@RequestBody Page<TaskInDto> page){
        return scienceServicesService.getUnResponded(page);
    }

    @ApiOperation(value = "查询任务计划接口")
    @PostMapping("/getPlanState")
    @ResponseBody
    public Page<TaskPlanOutDTO> getPlanState(@RequestBody Page<TaskPlanInDTO> page){
        Page<TaskPlanOutDTO> newPage= new Page<TaskPlanOutDTO>();
        newPage.setResult(scienceServicesService.getPlanState(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "人员分配与审核接口")
    @PostMapping("/getPerson")
    @ResponseBody
    public Page<TaskPlanOutDTO> getPerson(@RequestBody Page<TaskPlanInDTO> page){
        Page<TaskPlanOutDTO> newPage= new Page<TaskPlanOutDTO>();
        newPage.setResult(scienceServicesService.getPerson(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "设计验收接口")
    @PostMapping("/getDesign")
    @ResponseBody
    public Page<TaskDesignOutDto> getDesign(@RequestBody Page<TaskPlanInDTO> page){
        Page<TaskDesignOutDto> newPage= new Page<TaskDesignOutDto>();
        newPage.setResult(scienceServicesService.getDesign(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "清单备货接口")
    @PostMapping("/getCirculationList")
    @ResponseBody
    public Page<CirculationListOutDTO> getCirculationList(@RequestBody Page<CirculationListInDTO> page){
        Page<CirculationListOutDTO> newPage= new Page<CirculationListOutDTO>();
        newPage.setResult(scienceServicesService.getCirculationList(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }

    @ApiOperation(value = "时间统计")
    @PostMapping("/getTimes")
    @ResponseBody
    public Page<Times> getTimes(@RequestBody Page<TaskInDto> page){
        Page<Times> newPage= new Page<Times>();
        newPage.setResult(scienceServicesService.getTimes(page.getParams()));
        newPage.setMsg("查询成功");
        return newPage;
    }
}
